/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import ClasesAModificar.ColectivoModificar;
import src.Core;

/**
 *
 * @author Strauzen
 */
public class VentanaConsultaColectivo extends javax.swing.JFrame {

    Ventana1 v1;
    
    /**
     * Creates new form VentanaConsultaColectivo
     */
    public VentanaConsultaColectivo(Ventana1 v1) {
        this.v1 = v1;
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel_vcoNombre = new javax.swing.JLabel();
        jTextField_vcoNombre = new javax.swing.JTextField();
        jButton_VMOTerminar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

        jLabel_vcoNombre.setText("Nombre");

        jButton_VMOTerminar.setText("Terminar");
        jButton_VMOTerminar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_VMOTerminarMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel_vcoNombre)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextField_vcoNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(140, 140, 140)
                .addComponent(jButton_VMOTerminar)
                .addContainerGap(165, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel_vcoNombre)
                    .addComponent(jTextField_vcoNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(jButton_VMOTerminar)
                .addContainerGap(32, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton_VMOTerminarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton_VMOTerminarMouseClicked
        // TODO add your handling code here:
        ColectivoModificar CM = new ColectivoModificar(jTextField_vcoNombre.getText(), "",
                                                        -1, "", -1);
        String cole = Core.buscaEnLaBDPorColectivo(CM);
        VentanaConsultaEleccion vce = new VentanaConsultaEleccion(v1);
        vce.modificarTexto(cole);
        vce.setVisibleVCETipo(false);
        vce.setPadre(2);
        vce.setVisible(true);
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_jButton_VMOTerminarMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton_VMOTerminar;
    private javax.swing.JLabel jLabel_vcoNombre;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextField_vcoNombre;
    // End of variables declaration//GEN-END:variables
}
